///
/// Highlights the record in the PreRender event
///
private void RecordControl_PreRender(object sender, System.EventArgs e)
{
// Compare value to determine if you want to highlight the background of the row.
// For example, if ${Conditional Field Control} > 25, then, highlight.
// Note: You can also check if the field value equals a certain string,
// e.g, ${Conditional Field Control}.Text = "Yes".
if (double.Parse(this.${Conditional Field Control}.Text) == 25)
{
// Find the record row the field value is on.
System.Web.UI.HtmlControls.HtmlTableRow recordRow;
recordRow = (System.Web.UI.HtmlControls.HtmlTableRow)this.FindControl("MyTR");
// Set the background color on the record row in RGB format.
string color = "#ffff00";
// For each cell, set the background color.
foreach (System.Web.UI.HtmlControls.HtmlTableCell recordRowCell in recordRow.Cells)
{
// Override the record row background color -- since each data cell uses a
// style (by default: table_cell or table_cellr)
recordRowCell.Style.Add("background-color", color);
}
}
}
|